import 'particles.js';
import Stats from 'stats-js';
import './css/main.css';
import particles_json from './js/particle.json';

/* ---- particles.js config ---- */

particlesJS("particles-js", particles_json,function () {
        console.log('callback -particles.js config loaded');
});

console.log(particles_json.particles);


/* ---- stats.js config ---- */

var count_particles, stats, update;
stats = new Stats;
stats.setMode(0);
stats.domElement.style.position = 'absolute';
stats.domElement.style.left = '0px';
stats.domElement.style.top = '0px';
document.body.appendChild(stats.domElement);
count_particles = document.querySelector('.js-count-particles');
update = function() {
    stats.begin();
    stats.end();
    if (window.pJSDom[0].pJS.particles && window.pJSDom[0].pJS.particles.array) {
        count_particles.innerText = window.pJSDom[0].pJS.particles.array.length;
    }
    requestAnimationFrame(update);
};
requestAnimationFrame(update);